<template>
  <div class="setting-wechat">
    <el-tabs v-model="tabActiveName">
      <el-tab-pane label="基本配置" name="base">
        <base-form :setting="setting.wechat"></base-form>
      </el-tab-pane>
      <el-tab-pane label="通信配置" name="communication">
        <communication :setting="setting.wechat"></communication>
      </el-tab-pane>
      <el-tab-pane label="商户配置" name="pay">
        <pay-form :setting="setting.pay" @reset="getSetting"></pay-form>
      </el-tab-pane>
      <el-tab-pane label="公众号菜单" name="nav">
        <wechat-nav :setting="setting.wechat"></wechat-nav>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import BaseForm from './components/base-form'
import Communication from './components/communication-form'
import PayForm from './components/pay-form'
import WechatNav from './components/wechat-nav'
export default {
  name: 'SettingWechat',
  components: {
    BaseForm,
    Communication,
    PayForm,
    WechatNav
  },
  data() {
    return {
      tabActiveName: 'base',
      setting: {}
    }
  },
  mounted() {
    this.getSetting()
  },
  methods: {
    getSetting() {
      this.$get('setting')
        .then((res) => {
          this.setting = res.data.data
        })
    }
  }
}
</script>
